#include <REGX52.H>
#include <INTRINS.H>
#include "delay.h"
#include "LCD1602.h"
#include "IR.h"

unsigned char Num;
unsigned char ADDR;
unsigned char CMD;
extern unsigned char IR_State;
extern unsigned char IR_P;
extern unsigned char IR_CommendFlag;

void main()
{

	LCD_Init();
	LCD_ShowString(1, 1, "ADDR CMD Num");
	
	IR_Init();
	
	while(1)
	{
		if(IR_GetCommendFlag() || IR_GetRepeatFlag())
		{
			CMD = IR_GetCommend();
			ADDR = IR_GetAddress();
			LCD_ShowHexNum(2,1,ADDR,4);
			LCD_ShowHexNum(2,7,CMD,2);
			
			if(IR_VOL_ADD == CMD){
				Num++;
			}
			else if(IR_VOL_MINIM == CMD){
				Num--;
			}
			
			LCD_ShowHexNum(2,10,Num,2);
		}
	}
}



